<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title></title>
    <link rel="stylesheet" href="css/bootstrap.min.css"/>
    <link rel="stylesheet" type="text/css" href="css/htmleaf-demo.css">
    <link rel="stylesheet" href="css/manageStyle.css">
    <script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="js/bootstrap.min.js"></script>
    <script src="/js/underscore-noflect.js"></script>
</head>

<body>
<div id="wrapper">
    <div class="overlay"></div>
    <!-- Sidebar -->
    <nav class="navbar navbar-inverse navbar-fixed-top" id="sidebar-wrapper" role="navigation">
        <ul class="nav sidebar-nav">
            <li class="sidebar-brand">
                <a href="#">
                    <img src="img/userIcon.png"/>
                    <span>管理员： <%= username %></span>
                </a>
            </li>
            <li id="changePassword-btn">
                <a href="#">更改密码</a>
            </li>
            <li id="notion-message-btn">
                <a href="#">
                    <span>发布系统通知</span>
                </a>
            </li>
            <li id="teacher-manager-btn">
                <a href="#">学生信息管理</a>
            </li>
            <li id="lesson-manage-btn">
                <a href="#">用户管理</a>
            </li>
            <li id="grade-info-btn">
                <a href="#">成绩信息管理</a>
            </li>
            <li id="punishment-btn">
                <a href="#">处分信息管理</a>
            </li>
            <li id="lesson-info-btn">
                <a href="#">文件管理</a>
            </li>
            <li id="teacher-info-btn">
                <a href="#">教师信息管理</a>
            </li>
            <li>
                <a href="/exit">退出</a>
            </li>
        </ul>
    </nav>
    <div id="page-content-wrapper">
        <button type="button" class="hamburger is-closed animated fadeInLeft" data-toggle="offcanvas">
            <span class="hamb-top"></span>
            <span class="hamb-middle"></span>
            <span class="hamb-bottom"></span>
        </button>
        <div class="container">
            <div id="lesson-manage" style="display: none;">
                <h3>注册用户详情</h3>
                <div class="input-group col-md-3" style="margin-top:0px;positon:relative;margin-bottom: 20px">
                <input type="text" id="studentNameId" class="form-control" placeholder="请输入您的账号名"/>
                <span class="input-group-btn">
                        <button id="searchNameBtn" type="button" class="btn btn-primary">查找</button>
                    </span>
            </div>
                <table class="table table-bordered" id="referenceArea">
                    <thead>
                        <tr>
                            <th>账号名</th>
                            <th>加密后密码</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody >

                    </tbody>
                    <div id="studentNameDiv"></div>
                </table>
            </div>
            <div id="teacher-info-manage" style="display: none;">
                <h3>注册教师详情</h3>
                <div class="input-group col-md-3" style="margin-top:0px;positon:relative;margin-bottom: 20px">
                    <input type="text" id="teacherId" class="form-control" placeholder="请输入您的教师编号"/>
                    <span class="input-group-btn">
                        <button id="searchTeacherBtn" type="button" class="btn btn-primary">查找</button>
                    </span>
                </div>
                <table class="table table-bordered" id="teacherInfoArea">
                    <tr>
                        <!--<th>序号</th>-->
                        <th>账号名</th>
                        <th>教师姓名</th>
                        <th>教师编号</th>
                        <th>年龄</th>
                        <th>性别</th>
                        <th>所教专业</th>
                        <th>所属院系</th>
                        <th>联系电话</th>
                        <th>操作</th>
                    </tr>
                    <div id="teacherDiv"></div>
                </table>
            </div>
            <div id="lesson-info-upload" style="display: none;">
                <form action="/upLesson" method="post" enctype="multipart/form-data">
                    <div class="form-group">
                        <label>上传课程表</label>
                        <input type="file" class="form-control" id="touxiang" name="touxiang">
                    </div>
                    <button type="submit" class="btn btn-primary">上传</button>
                </form>
            </div>
            <div id="grade-info" style="display: none;">
                <h3>成绩记录详情</h3>
                <button id="addGrade" type="submit" class="btn btn-danger scrollto"
                        style="margin-bottom: 12px;margin-top: 5px" data-toggle="modal"
                        data-target="#addGrade-info">新增成绩
                </button>

                <div class="input-group col-md-3" style="margin-top:0px;positon:relative;margin-bottom: 20px">
                    <input type="text" id="studentId" class="form-control" placeholder="请输入您的学号"/>
                    <span class="input-group-btn">
                        <button id="searchGradeBtn" type="button" class="btn btn-primary">查找</button>
                    </span>
                </div>
                <table class="table table-bordered" id="studentInfoTableArea">
                </table>
                <table class="table table-bordered" id="gradeArea">
                    <tr>
                        <!--<th>学生姓名</th>-->
                        <!--<th>学生学号</th>-->
                        <th>课程名称</th>
                        <th>学年</th>
                        <th>学期</th>
                        <th>成绩</th>
                        <th>绩点</th>
                        <th>操作</th>
                    </tr>
                </table>
            </div>
            <div id="punishment-info" style="display: none;">
                <h3>处分记录详情</h3>
                <div class="input-group col-md-3" style="margin-top:0px;positon:relative;margin-bottom: 20px">
                    <input type="text" id="studentPunishId" class="form-control" placeholder="请输入您的学号"/>
                    <span class="input-group-btn">
                        <button id="searchPunishBtn" type="button" class="btn btn-primary">查找</button>
                    </span>
                </div>
                <button id="addPunish" type="submit" class="btn btn-danger scrollto"
                        style="margin-bottom: 12px;margin-top: 5px" data-toggle="modal"
                        data-target="#addPunish-info">新增处分
                </button>
                <table class="table table-bordered" id="punishArea">
                    <tr>
                        <th>学生名字</th>
                        <th>学号</th>
                        <th>受处分日期</th>
                        <th>违规详情</th>
                        <th>处分结果</th>
                        <th>操作</th>
                    </tr>
                    <div id="studentNameDiv1"></div>
                </table>
            </div>
            <div id="indexArea">
                <div class="jumbotron">
                    <h1>欢迎进入后台管理页面！</h1>
                    <p>welcome to manager page</p>
                    <p><a class="btn btn-primary btn-lg" href="/exit" role="button">Back home</a></p>
                </div>
            </div>
            <div id="change-password-area" style="display: none;">
                <h3>更改管理员密码</h3>
                <div style="display: block; height: 20px;"></div>
                <form class="form-horizontal">
                    <div class="form-group">
                        <label style="color: #eeeeee;" for="inputEmail3" class="col-sm-2 control-label">账号</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="denglumingM" placeholder="" disabled value="<%=username%>">
                        </div>
                    </div>
                    <div class="form-group">
                        <label style="color: #eeeeee;" class="col-sm-2 control-label">旧密码</label>
                        <div class="col-sm-10">
                            <input  type="password" class="form-control" value=""
                                    placeholder="请输入旧密码">
                        </div>
                    </div>
                    <div class="form-group">
                        <label style="color: #eeeeee;" class="col-sm-2 control-label">新密码</label>
                        <div class="col-sm-10">
                            <input  type="password" class="form-control" value=""
                                    placeholder="请输入新密码">
                        </div>
                    </div>
                    <div class="form-group">
                        <label style="color: #eeeeee;" class="col-sm-2 control-label">再次确认</label>
                        <div class="col-sm-10">
                            <input id="mimaM" type="password" class="form-control" value=""
                                   placeholder="请再次确认新密码">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class=" col-sm-offset-2 col-sm-10">
                            <button type="submit" id="changePasswordMBtn" class="btn btn-primary col-sm-12">更改</button>
                        </div>
                    </div>
                </form>
            </div>
            <div id="notion-message" style="display: none;">
                <form method="post">
                    <div class="form-group">
                        <label for="exampleInputEmail1">系统消息</label>
                        <input type="text" class="form-control" id="notionContent" placeholder="Information">
                    </div>
                </form>
                <button  class="btn btn-primary" id="notionSubmit">提交</button>
                <div class="alert alert-success" role="alert" id="cuowukuang" style="display: none;margin: 10px 0 0 0;">
                    提交成功！
                </div>
                <h3>系统消息记录</h3>
                <table class="table table-bordered" id="informArea">
                    <thead>
                        <tr>
                            <!--<th>ID</th>-->
                            <th>登录名</th>
                            <th>消息内容</th>
                            <th>发布时间</th>
                        </tr>
                    </thead>
                    <tbody id="informAreaBody">

                    </tbody>
                </table>
            </div>
            <div id="teacher-manager" style="display: none;">
                <form>
                    <h3>档案详情</h3>
                    <div class="input-group col-md-3" style="margin-top:0px;positon:relative;margin-bottom: 20px">
                        <input type="text" id="archiveStudentId" class="form-control" placeholder="请输入您的学号"/>
                        <span class="input-group-btn">
                        <button id="searchArchivesBtn" type="button" class="btn btn-primary">查找</button>
                    </span>
                    </div>
                    <table class="table table-bordered" id="lessonArea">
                        <thead>
                            <tr>
                                <th>账号</th>
                                <th>名字</th>
                                <th>学号</th>
                                <th>学校名称</th>
                                <th>联系电话</th>
                                <th>性别</th>
                                <th>所在班级</th>
                                <th>入学年份</th>
                                <th>政治面貌</th>
                                <!--<th>家庭情况</th>-->
                                <th>获奖情况</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>

                        </tbody>
                        <div id="archivesNotice"></div>
                    </table>
                </form>
            </div>
        </div>
    </div>
    <div class="modal fade" id="addGrade-info" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title-login" id="myModalLabel">新增</h4>
                </div>
                <div class="modal-body">
                    <form method="get" action="" class="form-horizontal" id="myModalBody">
                        <form method="get" action="" class="form-horizontal" id="myModalBody">
                            <div class="form-group has-feedback">
                                <label for="input" class="col-sm-2 control-label">姓名</label>
                                <div class="col-sm-10">
                                    <input id="studentNameA" type="text" class="form-control" value=""
                                           placeholder="请输入您的真实姓名">
                                </div>
                            </div>
                            <div class="form-group has-feedback">
                                <label for="input" class="col-sm-2 control-label">学号</label>
                                <div class="col-sm-10">
                                    <input id="teacherNumA" type="text" class="form-control" value=""
                                           placeholder="请输入您的学号">
                                </div>
                            </div>
                            <div class="form-group has-feedback">
                                <label for="input" class="col-sm-2 control-label">学年</label>
                                <div class="col-sm-10">
                                    <input id="testYearA" type="text" class="form-control" value=""
                                           placeholder="请输入考试学年">
                                </div>
                            </div>
                            <div class="form-group has-feedback">
                                <label for="input" class="col-sm-2 control-label">学期</label>
                                <div class="col-sm-10">
                                    <input id="testSemesterA" type="text" class="form-control" value=""
                                           placeholder="请输入考试学期">
                                </div>
                            </div>
                            <div class="form-group has-feedback">
                                <label for="inputPassword3" class="col-sm-2 control-label">考试科目</label>
                                <div class="col-sm-10">
                                    <input id="lessonCategoryA" type="text" class="form-control" value=""
                                           placeholder="请输入您的考试科目">
                                </div>
                            </div>
                            <div class="form-group has-feedback">
                                <label for="inputPassword3" class="col-sm-2 control-label">考试分数</label>
                                <div class="col-sm-10">
                                    <input id="allTimeA" type="text" class="form-control" value=""
                                           placeholder="请输入您考试分数">
                                </div>
                            </div>
                            <div class="form-group has-feedback">
                                <label for="inputPassword3" class="col-sm-2 control-label">绩点</label>
                                <div class="col-sm-10">
                                    <input id="gradePointA" type="text" class="form-control" value=""
                                           placeholder="请输入绩点分数">
                                </div>
                            </div>
                        </form>
                    </form>
                    <button type="submit" id="addGradeBtn" class="btn btn-lg btn-success btn-raised btn-block">提交
                    </button>
                    <hr style="margin-top:12px;">
                    <div class="form-horizontal">
                        <div class="clearfix">
                            <div class="pull-left">
                                <p class="form-control-static">Back home?</p>
                            </div>
                            <div class="pull-right">
                                <a href="/exit" class="btn btn-outline btn-default">return</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade" id="addPunish-info" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title-login" id="myModalLabel">新增</h4>
                </div>
                <div class="modal-body">
                    <form method="get" action="" class="form-horizontal" id="myModalBody">
                        <div class="form-group has-feedback">
                            <label for="input" class="col-sm-2 control-label">姓名</label>
                            <div class="col-sm-10">
                                <input id="studentNamePunish" type="text" class="form-control" value=""
                                       placeholder="请输入您的真实姓名">
                            </div>
                        </div>
                        <div class="form-group has-feedback">
                            <label for="input" class="col-sm-2 control-label">学号</label>
                            <div class="col-sm-10">
                                <input id="studentNumber" type="text" class="form-control" value=""
                                       placeholder="请输入您的学号">
                            </div>
                        </div>
                        <div class="form-group has-feedback">
                            <label for="input" class="col-sm-2 control-label">处分日期</label>
                            <div class="col-sm-10">
                                <input id="punishDate" type="text" class="form-control" value=""
                                       placeholder="请输入受处分日期">
                            </div>
                        </div>
                        <div class="form-group has-feedback">
                            <label for="input" class="col-sm-2 control-label">处分详情</label>
                            <div class="col-sm-10">
                                <input id="punishDetail" type="text" class="form-control" value=""
                                       placeholder="请输入处分详情">
                            </div>
                        </div>
                        <div class="form-group has-feedback">
                            <label for="input" class="col-sm-2 control-label">处分结果</label>
                            <div class="col-sm-10">
                                <input id="punishResult" type="text" class="form-control" value=""
                                       placeholder="请输入处分结果">
                            </div>
                        </div>
                    </form>
                    <button type="submit" id="addPunishBtn" class="btn btn-lg btn-success btn-raised btn-block">提交
                    </button>
                    <hr style="margin-top:12px;">
                    <div class="form-horizontal">
                        <div class="clearfix">
                            <div class="pull-left">
                                <p class="form-control-static">Back home?</p>
                            </div>
                            <div class="pull-right">
                                <a href="/exit" class="btn btn-outline btn-default">return</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade" id="updata-info" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title-login" id="myModalLabel">修改</h4>
                </div>
                <div class="modal-body">
                    <form method="get" action="" class="form-horizontal" id="archivesBody">

                    </form>
                    <button type="submit" id="updataBtn" class="btn btn-lg btn-success btn-raised btn-block">提交
                    </button>
                    <hr style="margin-top:12px;">
                    <div class="form-horizontal">
                        <div class="clearfix">
                            <div class="pull-left">
                                <p class="form-control-static">Back home?</p>
                            </div>
                            <div class="pull-right">
                                <a href="/exit" class="btn btn-outline btn-default">return</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade" id="teacher-info" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title-login" id="myModalLabel">修改</h4>
                </div>
                <div class="modal-body">
                    <form method="get" action="" class="form-horizontal" id="teacherInfoBody">

                    </form>
                    <button type="submit" id="updataTeacherInfoBtn" class="btn btn-lg btn-success btn-raised btn-block">提交
                    </button>
                    <hr style="margin-top:12px;">
                    <div class="form-horizontal">
                        <div class="clearfix">
                            <div class="pull-left">
                                <p class="form-control-static">Back home?</p>
                            </div>
                            <div class="pull-right">
                                <a href="/exit" class="btn btn-outline btn-default">return</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade" id="grade-info-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title-login" id="myModalLabel">修改</h4>
                </div>
                <div class="modal-body">
                    <form method="get" action="" class="form-horizontal" id="gradeBody">

                    </form>
                    <button type="submit" id="gradeModalBtn" class="btn btn-lg btn-success btn-raised btn-block">提交
                    </button>
                    <hr style="margin-top:12px;">
                    <div class="form-horizontal">
                        <div class="clearfix">
                            <div class="pull-left">
                                <p class="form-control-static">Back home?</p>
                            </div>
                            <div class="pull-right">
                                <a href="/exit" class="btn btn-outline btn-default">return</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade" id="punish-info-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title-login" id="myModalLabel">修改</h4>
                </div>
                <div class="modal-body">
                    <form method="get" action="" class="form-horizontal" id="punishBody">

                    </form>
                    <button type="submit" id="punishModalBtn" class="btn btn-lg btn-success btn-raised btn-block">提交
                    </button>
                    <hr style="margin-top:12px;">
                    <div class="form-horizontal">
                        <div class="clearfix">
                            <div class="pull-left">
                                <p class="form-control-static">Back home?</p>
                            </div>
                            <div class="pull-right">
                                <a href="/exit" class="btn btn-outline btn-default">return</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!--前端模板-->
<script type="text/template" id="informTemplate">
    <tr>
        <!--<td >{{=_id}}</td>-->
        <td>{{=dengluming}}</td>
        <td>{{=content}}</td>
        <td>{{=putTime}}</td>
    </tr>
</script>
<!--前端模板-->
<script type="text/template" id="lessonTemplate">
    <tr>
        <td>{{=dengluming}}</td>
        <td>{{=reallyName}}</td>
        <td>{{=teacherId}}</td>
        <td>{{=collegeName}}</td>
        <td>{{=telNum}}</td>
        <td>{{=sex}}</td>
        <td>{{=lesson}}</td>
        <td>{{=enterYear}}</td>
        <td>{{=politicalStatus}}</td>
        <!--<td>{{=familyInfo}}</td>-->
        <td>{{=awardInfo}}</td>
        <td><a id="{{=_id}}" onclick="showMoadl(id)" href="#updata-info" class="scrollto" data-toggle="modal"
               data-target="#updata-info">修改</a></td>
    </tr>
</script>
<!--前端模板-->
<script type="text/template" id="gradeTemplate">
    <tr>
        <td style="display: none">{{=_id}}</td>
        <!--<td>{{=studentName}}</td>-->
        <!--<td>{{=teacherNum}}</td>-->
        <td>{{=lessonCategory}}</td>
        <td>{{=testYear}}</td>
        <td>{{=testSemester}}</td>
        <td>{{=allTime}}</td>
        <td>{{=gradePoint}}</td>
        <td><a id="{{=_id}}" onclick="showMoadlGrade(id)" href="#" class="scrollto" data-toggle="modal"
               data-target="#grade-info-modal">修改</a> | <a id="{{=_id}}" onclick="deleteGrade(id)">删除</a></td>
    </tr>
</script>
<!--前端模板-->
<script type="text/template" id="punishTemplate">
    <tr>
        <!--<td>{{=_id}}</td>-->
        <td>{{=studentName}}</td>
        <td>{{=studentNumber}}</td>
        <td>{{=punishDate}}</td>
        <td>{{=punishDetail}}</td>
        <td>{{=punishResult}}</td>
        <td><a id="{{=_id}}" onclick="showModalPunish(id)" href="#" class="scrollto" data-toggle="modal"
               data-target="#punish-info-modal">修改</a></td>
    </tr>
</script>
<!--前端模板-->
<script type="text/template" id="referenceTemplate">
    <tr>
        <!--<td>{{=_id}}</td>-->
        <td>{{=dengluming}}</td>
        <td>{{=mima}}</td>
        <td id="{{=dengluming}}" onclick="deleteMethod(id)">删除</td>
    </tr>
</script>
<!--注册教师信息template-->
<script type="text/template" id="teacherInfoTemplate">
    <tr>
        <td>{{=dengluming}}</td>
        <td>{{=teacherName}}</td>
        <td>{{=teacherNum}}</td>
        <td>{{=teacherAge}}</td>
        <td>{{=sex}}</td>
        <td>{{=major}}</td>
        <td>{{=department}}</td>
        <td>{{=telNum}}</td>
        <td><a id="{{=dengluming}}" onclick="updataTeacherInfo(id)" class="scrollto" data-toggle="modal"
               data-target="#teacher-info">修改</a></td>
    </tr>
</script>
<!--前端模板-->
<script type="text/template" id="modalInfo">
    <form method="get" action="" class="form-horizontal">
        <div class="form-group has-feedback">
            <label for="input" class="col-sm-2 control-label">账号</label>
            <div class="col-sm-10">
                <input id="dengluming" type="text" class="form-control" disabled value="{{=dengluming}}"
                >
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="input" class="col-sm-2 control-label">姓名</label>
            <div class="col-sm-10">
                <input id="reallyName" type="text" class="form-control" value="{{=reallyName}}"
                       placeholder="请输入您的真实姓名">
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="input" class="col-sm-2 control-label">性别</label>
            <div class="col-sm-10">
                <input id="sex" type="text" class="form-control" value="{{=sex}}" placeholder="请输入您的性别">
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="input" class="col-sm-2 control-label">学号</label>
            <div class="col-sm-10">
                <input id="studentIdNumber" type="text" class="form-control" value="{{=teacherId}}"
                       placeholder="请输入您的学号">
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="input" class="col-sm-2 control-label">联系电话</label>
            <div class="col-sm-10">
                <input id="telNum" type="text" class="form-control" value="{{=telNum}}"
                       placeholder="请输入您的联系电话">
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="input" class="col-sm-2 control-label">身份证号</label>
            <div class="col-sm-10">
                <input id="IDnumber" type="text" class="form-control" value="{{=IDnumber}}"
                       placeholder="请输入您的身份证号">
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="input" class="col-sm-2 control-label">学校名称</label>
            <div class="col-sm-10">
                <input id="colleageName" type="text" class="form-control" value="{{=collegeName}}"
                       placeholder="请输入您所在学校名称">
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="inputPassword3" class="col-sm-2 control-label">政治面貌</label>
            <div class="col-sm-10">
                <input id="politicalStatus" type="text" class="form-control" value="{{=politicalStatus}}"
                       placeholder="请输入您政治面貌">
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="inputPassword3" class="col-sm-2 control-label">所在班级</label>
            <div class="col-sm-10">
                <input id="lesson" type="text" class="form-control" value="{{=lesson}}"
                       placeholder="请输入您所授课程">
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="inputPassword3" class="col-sm-2 control-label">入学年份</label>
            <div class="col-sm-10">
                <input id="enterYear" type="text" class="form-control" value="{{=enterYear}}"
                       placeholder="请输入您入学年份">
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="inputPassword3" class="col-sm-2 control-label">家庭信息</label>
            <div class="col-sm-10">
                <input id="familyInfo" type="text" class="form-control" value="{{=familyInfo}}"
                       placeholder="请输入您家庭信息">
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="inputPassword3" class="col-sm-2 control-label">得奖情况</label>
            <div class="col-sm-10">
                <input id="awardInfo" type="text" class="form-control" value="{{=awardInfo}}"
                       placeholder="请输入您得奖情况">
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="inputPassword3" class="col-sm-2 control-label">父母姓名</label>
            <div class="col-sm-10">
                <input id="parentName" type="text" class="form-control" value="{{=parentName}}" placeholder="请输入您父母姓名">
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="inputPassword3" class="col-sm-2 control-label">父母联系电话</label>
            <div class="col-sm-10">
                <input id="parentPhone" type="text" class="form-control" value="{{=parentPhone}}"
                       placeholder="请输入您父母联系电话">
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="inputPassword3" class="col-sm-2 control-label">初中学校</label>
            <div class="col-sm-10">
                <input id="primarySchool" type="text" class="form-control" value="{{=primarySchool}}"
                       placeholder="请输入您初中所在学校">
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="inputPassword3" class="col-sm-2 control-label">高中学校</label>
            <div class="col-sm-10">
                <input id="highSchool" type="text" class="form-control" value="{{=highSchool}}"
                       placeholder="请输入您高中所在学校">
            </div>
        </div>
    </form>
</script>
<!--前端模板-->
<script type="text/template" id="gradeModalTemplate">
    <form method="get" action="" class="form-horizontal">
        <div class="form-group has-feedback">
            <label for="input" class="col-sm-2 control-label">ID</label>
            <div class="col-sm-10">
                <input id="_idG" type="text" class="form-control" disabled value="{{=_id}}"
                       placeholder="">
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="input" class="col-sm-2 control-label">姓名</label>
            <div class="col-sm-10">
                <input disabled id="studentName" type="text" class="form-control" value="{{=studentName}}"
                       placeholder="请输入您的真实姓名">
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="input" class="col-sm-2 control-label">学号</label>
            <div class="col-sm-10">
                <input disabled id="teacherNum" type="text" class="form-control" value="{{=teacherNum}}"
                       placeholder="请输入您的学号">
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="input" class="col-sm-2 control-label">学年</label>
            <div class="col-sm-10">
                <input id="testYearG" type="text" class="form-control" value="{{=testYear}}"
                       placeholder="请输入考试学年">
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="input" class="col-sm-2 control-label">学期</label>
            <div class="col-sm-10">
                <input id="testSemester" type="text" class="form-control" value="{{=testSemester}}"
                       placeholder="请输入考试学期">
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="inputPassword3" class="col-sm-2 control-label">考试科目</label>
            <div class="col-sm-10">
                <input id="lessonCategory" type="text" class="form-control" value="{{=lessonCategory}}"
                       placeholder="请输入您的考试科目">
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="inputPassword3" class="col-sm-2 control-label">考试分数</label>
            <div class="col-sm-10">
                <input id="allTime" type="text" class="form-control" value="{{=allTime}}"
                       placeholder="请输入您考试分数">
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="inputPassword3" class="col-sm-2 control-label">绩点</label>
            <div class="col-sm-10">
                <input id="gradePointG" type="text" class="form-control" value="{{=gradePoint}}"
                       placeholder="请输入绩点分数">
            </div>
        </div>
    </form>
</script>
<!--punishModalTemplate-->
<script type="text/template" id="punishModalTemplate">
    <form method="get" action="" class="form-horizontal">
        <div class="form-group has-feedback">
            <label for="input" class="col-sm-2 control-label">ID</label>
            <div class="col-sm-10">
                <input id="_id" type="text" class="form-control" disabled value="{{=_id}}"
                       placeholder="">
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="input" class="col-sm-2 control-label">姓名</label>
            <div class="col-sm-10">
                <input disabled id="studentNameP" type="text" class="form-control" value="{{=studentName}}"
                       placeholder="请输入您的真实姓名">
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="input" class="col-sm-2 control-label">学号</label>
            <div class="col-sm-10">
                <input disabled id="studentNumber" type="text" class="form-control" value="{{=studentNumber}}"
                       placeholder="请输入您的学号">
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="input" class="col-sm-2 control-label">处分日期</label>
            <div class="col-sm-10">
                <input id="punishDateP" type="text" class="form-control" value="{{=punishDate}}"
                       placeholder="请输入受处分日期">
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="input" class="col-sm-2 control-label">处分详情</label>
            <div class="col-sm-10">
                <input id="punishDetail1" type="text" class="form-control" value="{{=punishDetail}}"
                       placeholder="请输入处分详情">
            </div>
        </div>
        <div class="form-group has-feedback">
            <label for="input" class="col-sm-2 control-label">处分结果</label>
            <div class="col-sm-10">
                <input id="punishResult1" type="text" class="form-control" value="{{=punishResult}}"
                       placeholder="请输入处分结果">
            </div>
        </div>
    </form>
</script>

<script type="text/template" id="teacherInfoModalTemplate">
        <form method="get" action="" class="form-horizontal">
            <div class="form-group has-feedback">
                <label for="input" class="col-sm-2 control-label">账号</label>
                <div class="col-sm-10">
                    <input id="dengluming" type="text" class="form-control" disabled value="{{=dengluming}}"
                    >
                </div>
            </div>
            <div class="form-group has-feedback">
                <label for="input" class="col-sm-2 control-label">教师姓名</label>
                <div class="col-sm-10">
                    <input id="teacherName" type="text" class="form-control" value="{{=teacherName}}"
                           placeholder="请输入您的真实姓名">
                </div>
            </div>
            <div class="form-group has-feedback">
                <label for="input" class="col-sm-2 control-label">教师编号</label>
                <div class="col-sm-10">
                    <input id="teacherNum1" type="text" class="form-control" value="{{=teacherNum}}" placeholder="请输入">
                </div>
            </div>
            <div class="form-group has-feedback">
                <label for="inputPassword3" class="col-sm-2 control-label">身份证号</label>
                <div class="col-sm-10">
                    <input id="IDnumber" type="text" class="form-control" value="{{=IDnumber}}"
                           placeholder="请输入">
                </div>
            </div>
            <div class="form-group has-feedback">
                <label for="input" class="col-sm-2 control-label">年龄</label>
                <div class="col-sm-10">
                    <input id="teacherAge" type="text" class="form-control" value="{{=teacherAge}}"
                           placeholder="请输入">
                </div>
            </div>
            <div class="form-group has-feedback">
                <label for="input" class="col-sm-2 control-label">性别</label>
                <div class="col-sm-10">
                    <input id="sex" type="text" class="form-control" value="{{=sex}}"
                           placeholder="请输入">
                </div>
            </div>
            <div class="form-group has-feedback">
                <label for="inputPassword3" class="col-sm-2 control-label">民族</label>
                <div class="col-sm-10">
                    <input id="national" type="text" class="form-control" value="{{=national}}"
                           placeholder="请输入">
                </div>
            </div>
            <div class="form-group has-feedback">
                <label for="inputPassword3" class="col-sm-2 control-label">籍贯</label>
                <div class="col-sm-10">
                    <input id="nativePlace" type="text" class="form-control" value="{{=nativePlace}}"
                           placeholder="请输入">
                </div>
            </div>
            <div class="form-group has-feedback">
                <label for="input" class="col-sm-2 control-label">教师职称</label>
                <div class="col-sm-10">
                    <input id="teacherTitle" type="text" class="form-control" value="{{=teacherTitle}}" placeholder="请输入您的职称">
                </div>
            </div>
            <div class="form-group has-feedback">
                <label for="input" class="col-sm-2 control-label">所授专业</label>
                <div class="col-sm-10">
                    <input id="major" type="text" class="form-control" value="{{=major}}"
                           placeholder="请输入">
                </div>
            </div>
            <div class="form-group has-feedback">
                <label for="input" class="col-sm-2 control-label">所在院系</label>
                <div class="col-sm-10">
                    <input id="department" type="text" class="form-control" value="{{=department}}"
                           placeholder="请输入">
                </div>
            </div>
            <div class="form-group has-feedback">
                <label for="inputPassword3" class="col-sm-2 control-label">联系电话</label>
                <div class="col-sm-10">
                    <input id="telNum" type="text" class="form-control" value="{{=telNum}}"
                           placeholder="请输入">
                </div>
            </div>
            <div class="form-group has-feedback">
                <label for="inputPassword3" class="col-sm-2 control-label">居住地址</label>
                <div class="col-sm-10">
                    <input id="address" type="text" class="form-control" value="{{=address}}"
                           placeholder="请输入">
                </div>
            </div>
        </form>
</script>

<script type="text/javascript">

    //日期格式化
    function Format(now,mask)
    {
        var d = now;
        var zeroize = function (value, length)
        {
            if (!length) length = 2;
            value = String(value);
            for (var i = 0, zeros = ''; i < (length - value.length); i++)
            {
                zeros += '0';
            }
            return zeros + value;
        };

        return mask.replace(/"[^"]*"|'[^']*'|\b(?:d{1,4}|m{1,4}|yy(?:yy)?|([hHMstT])\1?|[lLZ])\b/g, function ($0)
        {
            switch ($0)
            {
                case 'd': return d.getDate();
                case 'dd': return zeroize(d.getDate());
                case 'ddd': return ['Sun', 'Mon', 'Tue', 'Wed', 'Thr', 'Fri', 'Sat'][d.getDay()];
                case 'dddd': return ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'][d.getDay()];
                case 'M': return d.getMonth() + 1;
                case 'MM': return zeroize(d.getMonth() + 1);
                case 'MMM': return ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][d.getMonth()];
                case 'MMMM': return ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'][d.getMonth()];
                case 'yy': return String(d.getFullYear()).substr(2);
                case 'yyyy': return d.getFullYear();
                case 'h': return d.getHours() % 12 || 12;
                case 'hh': return zeroize(d.getHours() % 12 || 12);
                case 'H': return d.getHours();
                case 'HH': return zeroize(d.getHours());
                case 'm': return d.getMinutes();
                case 'mm': return zeroize(d.getMinutes());
                case 's': return d.getSeconds();
                case 'ss': return zeroize(d.getSeconds());
                case 'l': return zeroize(d.getMilliseconds(), 3);
                case 'L': var m = d.getMilliseconds();
                    if (m > 99) m = Math.round(m / 10);
                    return zeroize(m);
                case 'tt': return d.getHours() < 12 ? 'am' : 'pm';
                case 'TT': return d.getHours() < 12 ? 'AM' : 'PM';
                case 'Z': return d.toUTCString().match(/[A-Z]+$/);
                // Return quoted strings with the surrounding quotes removed
                default: return $0.substr(1, $0.length - 2);
            }
        });
    };
    //提交档案修改
    //用ajax提交表单
    $("#updataBtn").click(function () {
//        console.log("点击更新按钮！");
        $.get("/updata", {
            "dengluming": $("#dengluming").val(),
            "teacherId": $("#studentIdNumber").val(),
            "collegeName": $("#colleageName").val(),
            "politicalStatus": $("#politicalStatus").val(),
            "telNum": $("#telNum").val(),
            "sex": $("#sex").val(),
            "lesson": $("#lesson").val(),
            "enterYear": $("#enterYear").val(),
            "familyInfo": $("#familyInfo").val(),
            "awardInfo": $("#awardInfo").val(),
            "reallyName": $("#reallyName").val(),
            "IDnumber": $("#IDnumber").val(),
            "parentName": $("#parentName").val(),
            "parentPhone": $("#parentPhone").val(),
            "primarySchool": $("#primarySchool").val(),
            "highSchool": $("#highSchool").val()
        }, function (result) {
            if (result == "1") {
                alert("提交修改成功！，将自动跳转到后台管理首页");
                window.location = "/managePage";
            } else {
                alert("提交失败！，将自动跳转到后台管理首页");
                window.location = "/managePage";
            }
        })
    });

    //教师信息更改提交
    $("#updataTeacherInfoBtn").click(function () {
        $.get("/updataTeacher", {
            "dengluming": $("#dengluming").val(),
            "teacherName": $("#teacherName").val(),
            "teacherNum": $("#teacherNum1").val(),
            "major": $("#major").val(),
            "telNum": $("#telNum").val(),
            "sex": $("#sex").val(),
            "department":$("#department").val(),
            "teacherAge": $("#teacherAge").val(),
            "national": $("#national").val(),
            "nativePlace": $("#nativePlace").val(),
            "address": $("#address").val(),
            "IDnumber": $("#IDnumber").val(),
            "teacherTitle":$("#teacherTitle").val()
        }, function (result) {
            if (result == "1") {
                alert("提交修改成功！，将自动跳转到后台管理首页");
                window.location = "/managePage";
            } else {
                alert("提交失败！，将自动跳转到后台管理首页");
                window.location = "/managePage";
            }
        })
    });

    //  提交成绩修改
    $("#gradeModalBtn").click(function () {
        $.get("/updataGrade", {
            "_id": $("#_idG").val(),
            "testYear": $("#testYearG").val(),
            "testSemester": $("#testSemester").val(),
            "gradePoint": $("#gradePointG").val(),
            "lessonCategory": $("#lessonCategory").val(),
            "allTime": $("#allTime").val()
        }, function (result) {
            if (result == "1") {
                alert("更改成绩成功！，将自动跳转到后台管理首页");
                window.location = "/managePage";
            } else {
                alert("更改成绩失败！，将自动跳转到后台管理首页");
                window.location = "/managePage";
            }
        })
    });


    //提交惩罚修改 punishModalBtn
    $("#punishModalBtn").click(function () {
        $.get("/updataPunish", {
            "studentName": $("#studentNameP").val(),
            "punishDate": $("#punishDateP").val(),
            "punishDetail": $("#punishDetail1").val(),
            "punishResult": $("#punishResult1").val()
        }, function (result) {
            if (result == "1") {
                alert("提交修改成功！，将自动跳转到后台管理首页");
                window.location = "/managePage";
            } else {
                alert("提交失败！，将自动跳转到后台管理首页");
                window.location = "/managePage";
            }
        })
    });

    //新增成绩 addGradeBtn
    $("#addGradeBtn").click(function () {
        $.get("/addGrade", {
            "studentName":$("#studentNameA").val(),
            "teacherNum":$("#teacherNumA").val(),
            "testYear": $("#testYearA").val(),
            "testSemester": $("#testSemesterA").val(),
            "gradePoint": $("#gradePointA").val(),
            "lessonCategory": $("#lessonCategoryA").val(),
            "allTime": $("#allTimeA").val()
        }, function (result) {
            if (result == "1") {
                alert("新增成绩成功！，将自动跳转到后台管理首页");
                window.location = "/managePage";
            } else {
                alert("新增成绩失败！，将自动跳转到后台管理首页");
                window.location = "/managePage";
            }
        })
    })

    //新增处分
    $("#addPunishBtn").click(function () {
        console.log($("#studentName").val());
        $.get("/addPunish", {
            "studentName": $("#studentNamePunish").val(),
            "studentNumber": $("#studentNumber").val(),
            "punishDate": $("#punishDate").val(),
            "punishDetail": $("#punishDetail").val(),
            "punishResult1": $("#punishResult1").val()
        }, function (result) {
            if (result == "1") {
                alert("新增处分成功！，将自动跳转到后台管理首页");
                window.location = "/managePage";
            } else {
                alert("新增处分失败！，将自动跳转到后台管理首页");
                window.location = "/managePage";
            }
        })
    })

    //删除用户
    function deleteMethod(idname) {
        $.get("/deleteUser", {
            "deleteid": idname
        }, function (result) {
            if (result == "1") {
                alert("删除用户成功！");
                window.location = "/managePage";
            } else {
                alert("删除用户失败！");
                window.location = "/managePage";
            }
        })
    }
    //删除成绩
    function deleteGrade(idname) {
//        console.log("点击修改按钮！"+idname);
        $.get("/deleteGrade", {
            "deleteid": idname
        }, function (result) {
            if (result == "1") {
                alert("删除该条成绩成功！");
                window.location = "/managePage";
            } else {
                alert("删除该条成绩失败！");
                window.location = "/managePage";
            }
        })
    }
    var $archivesBody = $("#archivesBody");
    //得到模板函数
    var compiledModal = _.template($("#modalInfo").html());
    //显示修改档案
    function showMoadl(idname) {
//        console.log("显示" + idname);
        $.get("/showModal", {
            "modalId": idname
        }, function (result) {
//            console.log("123" + result);
            iterator(0);
            //迭代器
            //这里防止ajax异步，必须使用迭代器
            function iterator(i) {
                if (i == result.length) {
                    //在这里书写请求完毕之后做的事情
                    return;  //不用继续迭代了
                }
//                console.log(result[i]);
                //组装模板
                var modalString = compiledModal(result[i]);
                //添加DOM
                $("#archivesBody").html($(modalString));
                iterator(i + 1);
            }
        })
    }
    var $gradeBody = $("#gradeBody");
    //得到模板函数
    var compiledGradeModal = _.template($("#gradeModalTemplate").html());
    //显示修改成绩
    function showMoadlGrade(idname) {
        $.get("/showGradeModal", {
            "gardeModalId": idname
        }, function (result) {
            iterator(0);
            //迭代器
            //这里防止ajax异步，必须使用迭代器
            function iterator(i) {
                if (i == result.length) {
                    //在这里书写请求完毕之后做的事情
                    return;  //不用继续迭代了
                }
                console.log(result[i]);
                //组装模板
                var gradeString = compiledGradeModal(result[i]);
                //添加DOM
                $("#gradeBody").html($(gradeString));
                iterator(i + 1);
            }
        })
    }
    //
    var $punishBody = $("#punishBody");
    //得到模板函数
    var compiledPunishModal = _.template($("#punishModalTemplate").html());
    //显示处分
    function showModalPunish(idname) {
//        console.log("成绩" + idname);
        $.get("/showPunishModal", {
            "punishModalId": idname
        }, function (result) {
//            console.log(result);
            iterator(0);
            //迭代器
            //这里防止ajax异步，必须使用迭代器
            function iterator(i) {
                if (i == result.length) {
                    //在这里书写请求完毕之后做的事情
                    return;  //不用继续迭代了
                }
                console.log(result[i]);
                //组装模板
                var punishString = compiledPunishModal(result[i]);
                //添加DOM
                $("#punishBody").html($(punishString));
                iterator(i + 1);
            }
        })
    }

    var $informArea = $("#informArea");
    //得到模板函数
    var compiled = _.template($("#informTemplate").html());

    //ajax服务，获取信息
    $.ajax({
        "url": "/showInform",
        "type": "get",
        "success": function (result) {
            iterator(0);
            function iterator(i) {
                if (i == result.length) {
                    return;  //不用继续迭代了
                }
                //组装模板
                var htmlstring = compiled(result[i]);
                //添加DOM
                $("#informArea").append($(htmlstring));
                iterator(i + 1);
            }
        }
    })

    //修改教师信息
    var compiledteacherInfoM = _.template($("#teacherInfoModalTemplate").html());
    //显示修改档案
    function updataTeacherInfo(idname) {
        $.get("/showTeacherInfo", {
            "dengluming": idname
        }, function (result) {
//            console.log("123" + result);
            iterator(0);
            //迭代器
            //这里防止ajax异步，必须使用迭代器
            function iterator(i) {
                if (i == result.length) {
                    //在这里书写请求完毕之后做的事情
                    return;  //不用继续迭代了
                }
//                console.log(result[i]);
                //组装模板
                var modalString = compiledteacherInfoM(result[i]);
                //添加DOM
                $("#teacherInfoBody").html($(modalString));
                iterator(i + 1);
            }
        })
    }



    //课程
    var $lessonArea = $("#lessonArea");
    //得到模板函数
    var compiledL = _.template($("#lessonTemplate").html());
    $.ajax({
        "url": "/showLesson",
        "type": "get",
        "success": function (result) {
            //result是一个数组
//                console.log(Array.isArray(result));
            console.log("123" + result);
            iterator(0);
            //迭代器
            //这里防止ajax异步，必须使用迭代器
            function iterator(i) {
                if (i == result.length) {
                    //在这里书写请求完毕之后做的事情
                    return;  //不用继续迭代了
                }
                console.log(result[i]);
                //组装模板
                var htmlstring = compiledL(result[i]);
                //添加DOM
                $("#lessonArea").append($(htmlstring));
                iterator(i + 1);
            }
        }
    })
    //资料表格
    var $referenceArea = $("#referenceArea");
    //得到模板函数
    var compiledR = _.template($("#referenceTemplate").html());
    $.ajax({
        "url": "/showRefresh",
        "type": "get",
        "success": function (result) {
            //result是一个数组
//                console.log(Array.isArray(result));
            console.log(result);
            iterator(0);
            //迭代器
            //这里防止ajax异步，必须使用迭代器
            function iterator(i) {
                if (i == result.length) {
                    //在这里书写请求完毕之后做的事情
                    return;  //不用继续迭代了
                }
                //组装模板
                var htmlstring = compiledR(result[i]);
                //添加DOM
                $("#referenceArea").append($(htmlstring));
                iterator(i + 1);
            }
        }
    })
    //    注册教师详情
    var compiledTe = _.template($("#teacherInfoTemplate").html());
    $.ajax({
        "url": "/showTeacherList",
        "type": "get",
        "success": function (result) {
            iterator(0);
            function iterator(i) {
                if (i == result.length) {
                    return;
                }
                let htmlstring = compiledTe(result[i]);
                //添加DOM
                $("#teacherInfoArea").append($(htmlstring));
                iterator(i + 1);
            }
        }
    })
    var compiledGrade = _.template($("#gradeTemplate").html());
    $("#searchGradeBtn").click(function () {
        $.get("/searchGrade", {
            "studentId": $("#studentId").val()
        }, function (result) {
            if (result == "") {
                alert("没有该学生成绩");
            }
            let studentN=result[0].studentName;
            let studentId=result[0].teacherNum;
            $("#studentInfoTableArea").html(`<tr>
                <th >学生姓名</th>
                <th>学生学号</th>
            </tr>
            <tr>
                <td>${studentN}</td>
                <td>${studentId}</td>
            </tr>`)
            iterator(0);
            function iterator(i) {
                if (i == result.length) {
                    return;
                }
                console.log(result[i]);
                var htmlstring = compiledGrade(result[i]);
                $("#gradeArea").append($(htmlstring));
                iterator(i + 1);
            }
        })
    })
    //查询档案
    var compiledArchives = _.template($("#lessonTemplate").html());
    $("#searchArchivesBtn").click(function () {
        $("#lessonArea").html("");
        $.get("/searchArchives", {
            "studentId": $("#archiveStudentId").val()
        }, function (result) {
            if (result == "") {
                $("#archivesNotice").html("没有该用户档案");
            }
            iterator(0);
            function iterator(i) {
                if (i == result.length) {
                    //在这里书写请求完毕之后做的事情
                    return;  //不用继续迭代了
                }
                $("#lessonArea").html(`<tr>
                                <th>账号</th>
                                <th>名字</th>
                                <th>学号</th>
                                <th>学校名称</th>
                                <th>联系电话</th>
                                <th>性别</th>
                                <th>所在班级</th>
                                <th>入学年份</th>
                                <th>政治面貌</th>
                                <th>获奖情况</th>
                                <th>操作</th>
                            </tr>`)
                //组装模板
                var htmlstring = compiledArchives(result[i]);
                //添加DOM
                $("#lessonArea").append($(htmlstring));
                iterator(i + 1);
            }
        })
    })

    //查询用户
    var compiledRe = _.template($("#referenceTemplate").html());
    $("#searchNameBtn").click(function () {
        $("#referenceAreaTbody").html("");
        $.get("/searchName", {
            "studentId": $("#studentNameId").val()
        }, function (result) {
            if (result == "") {
                $("#studentNameDiv").html("没有该用户注册信息")
            }
            iterator(0);
            function iterator(i) {
                if (i == result.length) {
                    return;
                }
                $("#referenceArea").html(`<thead>
                        <tr>
                            <th>账号名</th>
                            <th>加密后密码</th>
                            <th>操作</th>
                        </tr>
                    </thead>`)
                var htmlstring = compiledRe(result[i]);
                $("#referenceArea").append($(htmlstring));
                iterator(i + 1);
            }
        })
    })

    //查询教师
    var compiledTeI = _.template($("#teacherInfoTemplate").html());
    $("#searchTeacherBtn").click(function () {
        $("#teacherInfoArea").html("");
        $.get("/searchTeacher", {
            "studentId": $("#teacherId").val()
        }, function (result) {
            if (result == "") {
                $("#teacherDiv").html("没有该教师注册信息")
            }
            iterator(0);
            function iterator(i) {
                if (i == result.length) {
                    return;
                }
                $("#teacherInfoArea").html(`<thead>
                         <tr>
                        <th>账号名</th>
                        <th>教师姓名</th>
                        <th>教师编号</th>
                        <th>年龄</th>
                        <th>性别</th>
                        <th>所教专业</th>
                        <th>所属院系</th>
                        <th>联系电话</th>
                             <th>操作</th>
                    </tr>
                    </thead>`)
                var htmlstring = compiledTeI(result[i]);
                $("#teacherInfoArea").append($(htmlstring));
                iterator(i + 1);
            }
        })
    })

    var compiledPu = _.template($("#punishTemplate").html());
    $("#searchPunishBtn").click(function () {
        $("#punishArea").html("");
        $.get("/searchPunish", {
            "studentId": $("#studentPunishId").val()
        }, function (result) {
            if (result == "") {
                $("#studentNameDiv1").html("没有该用户处分信息")
            }
            iterator(0);
            function iterator(i) {
                if (i == result.length) {
                    return;
                }
                $("#punishArea").html(`
    <thead><tr>
                        <th>学生名字</th>
                        <th>学号</th>
                        <th>受处分日期</th>
                        <th>违规详情</th>
                        <th>处分结果</th>
                        <th>操作</th>
                    </tr></thead>`)
                var htmlstring = compiledPu(result[i]);
                $("#punishArea").append($(htmlstring));
                iterator(i + 1);
            }
        })
    })

    //处分详情
    //得到模板函数
    var compiledPunish = _.template($("#punishTemplate").html());

    $.ajax({
        "url": "/showPunish",
        "type": "get",
        "success": function (result) {
            iterator(0);
            function iterator(i) {
                if (i == result.length) {
                    //在这里书写请求完毕之后做的事情
                    return;  //不用继续迭代了
                }
                console.log("punish--------------");
                console.log(result[i]);
                //组装模板
                var punishString = compiledPunish(result[i]);
                //添加DOM
                $("#punishArea").append($(punishString));
                iterator(i + 1);
            }
        }
    })

    $(document).ready(function () {
        var trigger = $('.hamburger'),
            overlay = $('.overlay'),
            isClosed = false;

        trigger.click(function () {
            hamburger_cross();
        });
        function hamburger_cross() {
            if (isClosed == true) {
                overlay.hide();
                trigger.removeClass('is-open');
                trigger.addClass('is-closed');
                isClosed = false;
            } else {
                overlay.show();
                trigger.removeClass('is-closed');
                trigger.addClass('is-open');
                isClosed = true;
            }
        }

        $("#referenceBtn").click(function () {
            alert($("#touxiang").val());
        })
        $('[data-toggle="offcanvas"]').click(function () {
            $('#wrapper').toggleClass('toggled');
        });
        $('#lesson-manage-btn').click(function () {
            $("#lesson-manage").show();
            $("#lesson-manage").siblings().hide();
        });
        $("#teacher-info-btn").click(function () {
            $("#teacher-info-manage").show();
            $("#teacher-info-manage").siblings().hide();
        });
        $("#changePassword-btn").click(function () {
            $("#change-password-area").show();
            $("#change-password-area").siblings().hide();
        })
        $("#lesson-info-btn").click(function () {
            $("#lesson-info-upload").show();
            $("#lesson-info-upload").siblings().hide();
        })
        $('.dropdown li').click(function () {
            $('#resource-upload').show();
            $("#resource-upload").siblings().hide();
//            $("#sidebar-wrapper").hide();
        });
        $('#notion-message-btn').click(function () {
            $("#notion-message").show();
            $('#notion-message').siblings().hide();
//            $("#sidebar-wrapper").hide();
        });
        $("#teacher-manager-btn").click(function () {
            $("#teacher-manager").show();
            $("#teacher-manager").siblings().hide();
        })
        $("#grade-info-btn").click(function () {
            $("#grade-info").show();
            $("#grade-info").siblings().hide();
        })
        $("#punishment-btn").click(function () {
            $("#punishment-info").show();
            $("#punishment-info").siblings().hide();
        })
//        //获取val
//        $("#manageSubmitBtn").click(function () {
////            console.log("提交！");
//            $.get("/updataLesson", {
//                "dengluming": $("#teacher_name").val(),
//                "lessonTitle": $("#lesson_name").val(),
//                "lessonDetail": $("#lesson_detail").val(),
//                "lessonLevel": $("#lesson_level").val(),
//                "lessonPopulation": $("#student_number").val(),
//                "lessonPath": $("#lesson_url").val()
//            }, function (result) {
//                if (result == "1") {
//                    alert("提交成功！，将自动跳转到首页");
////                    window.location = "/";
//                } else {
//                    alert("提交失败！，将自动跳转到首页");
////                    window.location = "/";
//                }
//            })
//        });

        //上传通知
        $("#notionSubmit").click(function () {
            //本页添加
           let NContent=$("#notionContent").val();
           let a=new Date();
           let time=Format(a,"yyyy-MM-dd HH:mm")
           console.log("1111:");
           $("#informAreaBody").prepend(`
                                <tr>
                                    <td>admin</td>
                                    <td>${NContent}</td>
                                    <td>${time}</td>
                                </tr>`)

            $.get("/addNotion", {
                "notionContent": $("#notionContent").val(),
            }, function (result) {
                if (result == "1") {
                    $("#cuowukuang").fadeIn();
//                    window.location.reload();
                } else {
                    $("#cuowukuang").fadeIn();
                    $("#cuowukuang").html("提交失败");
                }
            })
        });

        //changePasswordM
        $("#changePasswordMBtn").click(function () {
            //用ajax提交表单
            $.post("/changePasswordM", {
                "denglumingdefault": $("#denglumingM").val(),
                "mimachange": $("#mimaM").val()
            }, function (result) {
                if (result == "1") {
                    alert("更改成功！");
                } else {
                    alert("更改失败！");
                }
            })
        })
        $("input").focus(function(){
            $("#cuowukuang").fadeOut();
        });
    });
</script>

</div>
</body>
</html>